package transTream;

import java.io.*;

public class transform {

    public static void main(String[] args) throws Exception{

        // 创建字节输入流对象
        FileInputStream in = new FileInputStream("src/transTream/reader.txt");
        // 将字节流输入对象转化为字符流输入对象
        InputStreamReader inputStreamReader = new InputStreamReader(in);
        // 创建字符输入缓冲流对象
        BufferedReader br = new BufferedReader(inputStreamReader);

        // 创建字节输出流对象
        FileOutputStream out = new FileOutputStream("src/transTream/writer.txt");
        // 将字节输出流对象转化为字符流输出对象
        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(out);
        // 创建字符输出缓冲流对象
        BufferedWriter bw = new BufferedWriter(outputStreamWriter);

        // 定义一个字符串
        String str = null;
        // 遍历
        while ((str= br.readLine())!=null){
            bw.write(str);
            bw.newLine();
        }

        // 关闭流
        br.close();
        bw.close();

    }
}
